<?php
	include "../../public/commom/config.php";
	include "../lock2.php";
?>

<!DOCTYPE html>
<html>
	
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css">
	</head>
	
	<body>
		<h1>添加商品</h1>
		<form action="add1.php" method="post" enctype="multipart/form-data">
				<label>
					名称：
					<input type="text" name="name" placeholder="请输入名称..." autocomplete="off" />
				</label>
				<label>
					价格：
					<input type="text" name="price" placeholder="请输入价格..." autocomplete="off" />
				</label>
				<label>
					库存：
					<input type="text" name="inventory" placeholder="请输入库存..." autocomplete="off" />
				</label>
				<label>
					商品品牌：
					<select name="brand_id">
						<?php
							$csql = "SELECT * FROM class";
						
							$cresult = mysqli_query($conn, $csql);
							
							while($row = mysqli_fetch_array($cresult)) {
								echo "<option disabled>" . $row["name"] . "</option>";
								
								$bsql = "SELECT * FROM brand WHERE " . $row['id'] . " = class_id";
								
								$bresult = mysqli_query($conn, $bsql);
								
								while($row = mysqli_fetch_array($bresult)) {
									echo "<option value=" . $row["id"] . ">" . $row["name"] . "</option>";
								}
								
							}
						?>
					</select>
				</label>
			商品状态：
				<label>
					<input type="radio" name="shelf" value="0" checked>上架
				</label>
				<label>
					<input type="radio" name="shelf" value="1">下架
				</label>
				<label>
					上传图片：
					<input type="file" name="img" accept="image/gif, image/jpeg, image/png, image/jpg, image/webp">		
				</label>
			<input type="submit" value="添加"/>
		</form>
	</body>
	
</html>